fixed bugs in example code