fixed problem with teacher's code