corrected the storing of indexes