fixed up bugs for HW1 solution