fixing bugs in the demo that made it into the prev version