Improved solution for canceling sync.