Update main.js

Fix bug in Firefox