Some fixes to auto_partition