corrected environment variable handling