error handling for sync