optimized checking intersection distance, fix