code cleaning, fix nan from codegen