Fix two problems in main.js

Fix two big problems!