Fix possible memory leak #4