Fixed memory leak tests