Fixed all memory leaks.