Fix session bugs