Fix bug. in location calculation.