Better error handling for sync