leave session bug fix