fix a few remaining memory leaks