minor cleanups
combine in one call, and fix issue when item is registered and
unregistered at the same time
minor performance fix