Update lastIndexInSession to fix UI bug