a bit of bug fixing for cs520 prog4