fix for listing 6
Merge pull request #158 from aringlis/listing6

Fix for code in listing 6