fixed env variable handling