bldenv: fix regressions and add (un)setenv lost in merge