making conditional statement in drienvironment more robust