Fixed handling of error statuses.