make sure the variable is defined before trying to read it