Fixed memory leaks 2. Not yet tested