rewrited session check logic