fix a potential memory leak