Fixed global DOM event listener scope bug