Fixed potential memory leak