Set correct index to session from history