fixed a bug in mhd codegen