add reference count (not finished)