Fixed distance calculation bug that was skipping some walls