fixed a bug when calling with Class fitting functions