chapter 5 not giving the desired result