Update main.js

Another try to fix a bug...