modified utils.py in the case that portion = 1