fix for a few memory leaks!