change to another method to set global variables. Replace all 'DAE' in functions to '.GlobalEnv'. Works fine