Bug fixes in TileHelper, and added more test cases for TileHelperTest.