Prevent dangle weak ptr bug