[patch] my_setenv speedup + fixes