HW4 with some bug