Fixed a side-effect bug by the generated module rewrite