Chapter9: fixed bugs