Fixed javascript bug in main.js