Fix flashes bug, fix logout