fix bug in session check