Update main.js

Fix two big problems!