fixed a couple errors in the multithreaded only code in env.c