memory leak
updating mem