fixed rangefinder code.