Corrected some minor memory leaks