Fixed minor errors in session management code.