Fix bug that allowed an illegal move