Making DOM.js a bit more robust