fixed type check problem in problem 6