fixing bugs in the demo