Improved logic for sync termination