Modified json refcount implementation