protect against memory leaks