modify fold method