fixed ch06 problem