Fix cleanup if sharding is true