Rewritted session code and logout is working.