cleanup in apiclient