fix bugs in index