Update main.js

Fixed a possible bug...