Merge "Revert "Improve the code of handleSessionLost()""