bug fixes in example code