Fixes race  condition that happens only with zero shards