created a function to check if variable is set