Update code.js

Fixed bugs with Firefox