fixing session management bug