make the trailing on algorithm update the env properly
#1721
+9
−11
on algorithm update the env properly
#1721