fixes the 'undefined device variable' bug