lecture 16: fix small bugs