Improve environment variable handling.