* fixed bug with distance correction code