fix for some memory leaks on the iOS client