a fix in mainfunction_post