bug fix: new functions couldn't be used as values when out of scope
More leak fixes, esp a bad one in list_copy