synchronized class loading properly - fixes #2108

[skip ci]