update session handling to be more precise