Fixed bugs in minimax