Only fix error code if needed