Fixed some bugs in index