fixed a bug in duplicate tile detection