Fixed premature deletion in get_partition