Fixed the demo #6 code