Fixed bug when removing empty partitions