bug fixes for the recursion of validMove