Fix end session and disconnect event