Fixed memory leaks, delete all alloc'ed objects