Added error catching for sync