made some bug fixes to index