Fix bugs with codegen and add atutil wrapping