fix bug in resource class due to overuse of noexcept