Remove last chdir for thread safety
Version up to 2.6.0