fixed memory leak on deinit phase