make isRebalancing safe