handle nil enviornment