Fixed error with index