use different approach to check nullable env var #2523 #2171