fixed all memory leaks in tests