hopefully fix huge memory leaks