Fix shared_from_this() bug