Fixed AI bug of early termination