Solved HW6 bugs