Fixed bugs that turned up in the demo