bugfix: be more conservative in rebalancing semaphore counters - Thanks to Irina for reporting