fixed exception thrown when unregistering resources