small enhancements

Make sure the updated_history is defined when the history json.load fails
Make sure the selected index compensates for the deleted entry