Error handling bug fix, and example bug fix