fix small bug in correctness and loop invariant code