Merge tiles.lua fix from master