Fix memory leaks; fix misusing of GSequence API.