memory leak detected and solved