better error control in examples