fixed demo code