remove MathError, use contract programming (requires)
replace append_c with append_unichar