Use iterator to remove items instead of calling unregister* methods.