fixed memory leak and iterative_test