Fix memory management bug

... which we are hitting only due to other redesigns.