Fixed some bugs with tile coordinate conversion