Made initialization of registered classes more robust against exceptions.