mostly fixing potential memory leaks