better login stuff and trying to set flags