Fixed BAD_ACCESS memory problems