Fixed bug with index stopping