fixed #3305, add chapter7 sample code.