Fixed a bug related to weak-reference.