fixed initial index bug (resets to 1 each time refreshed page)