adding unsetenv, correcting a few errors