fix genmove to select valid move or pass