Fix invalid partition size calculations