fixed duplicated generation of enterfunc if more than one state use the same function.