Corrected minor bugs with early termination.