fixed memory freeing order. fixes crash on iphone