fix navigate key problems on Firefox;
clean up main.js;
fix bug;