index: use refcounting instead of locking