fix: several memory leaks