Fixed bugs in index