Update main.js

Please check your code and test it...