fixes error in chapter 4, close #20