Fix several leaks