rewrite to facilitate reliable GC