Fixed some bugs in TMX