Fixed a crash when a sync function fails.