fix ref cnt bug