index now working properly in non-first pages