Corrected calculation of coordinates in the forest