add weak ref sample code