Added error handling in TileEngine