fixed a bug in weighByMultiClasses that caused errors when using multiple aggregation levels