Fix bug in minmax and update heuristic