improve session constructor