fix a nasty memory leak on ios