Tiled: fix bugs but still wrong result