Fix minor bugs in api client helper