Fix for possible memory leak