fix some memory leaks on iOS