fixed the demo code