Fixed bugs in firefox.js