checks variables are set befor assigning