Plugged a few memory leaks