Fixed a few bugs in index.coffee