improve sesssion handling