fixing various leaks