fixed solution to excercise 4