minor cleanings and exposing a function to get the internal refcount of an object