Fixes bug in chapter2 example