fixed reference count bug.