Add error examples; fix corresponding bugs and error messages