Fixed some coordinate conversion bugs