Critical IdRegisteredClass fix

Fixed crashing on exit