Fix session restart bug