changed session logic