Added preservation of error codes