Fix a bug that there is a garbage of 0 at the end of each partition.