Fixed exception-safety when callbacks throw exceptions