Bug fix on getting shared pointer from a weak pointer.