fixed bug in session check