Fix overwritting tile bug [issue #1].