check for valid move