Fix a bug in retain couting