Fix GC bugs caused by late rooting.

Now non-concurrent programs run with a small GC period without crashing.
Concurrent programs are still a WIP.