misplaced tile heuristic and bug fixes.