fixed the problem of needing an initial session with an if statement