another fix for the long distance NaN problem