Cleared some memory leaks.