updated leakcheck tests, fixed some pointer issued along the way