added session safety support