bugfix in the generated forward_one and reverse_one functions when there are loops involved