add fix to memory leak