Fixing error catching.