Fix session handling