run when goIndex is called