memory leak corrections