shared_ptr going out of scope = :(