Fixed class loading for factories