Added on_scope_exit