fixed a potential memory leak