fixed a possible memory leak