repaired a code generation example
added info to error message, related to index out of range, to strongly simplify debugging