Fix the persisting apikey and username issue