Update main.js

Fix two big problems!
Merge pull request #10 from Denisov21/patch-5

Fix two problems in main.js