weak ptr check snippet