fix minor bugs from ch 8