global variables weren't working