Fix bug when unregistering object database