Bugfix in imbalance calc