c_scan can only return one entity. And the returned distance is the distance to the next entity. If no entity is in scan range, no distance is returned. If you need to scan all entities, you must use events. Look up ENABLE_DETECT and ENABLE_SCAN in the manual.