fix inappropriate clearing of API tokens

closes #58