Added a destructor to plug memory leak.