Fixing bugs in HW 4 1)