Fixed segfault due to concurrent use of putenv