Fix for potential memory leak