Proper saving of historylist and current history index to the backend