Fixed bug with coordinate system conversion