Potential memory leak fixed