Improved handling of dynamic class initialisation.