safe check on global variables