bug fix for "Uncaught TypeError: Cannot read property 'open' of undefined"