Fixed most mem leaks