Fixed all memory leaks