fixes exhaustion bug and missing GC_ref code generation