eliminate memory leak
further tidy