fixed potential memory leak