Fixes bugs when clicking on tiles.