small bug fix at terrain postion calculation