Cure some memory leaeks