session writing fixed