Correcting an error with indexes