Fix bug in garbage collector.

This commit fixes a bug in garbage collector which prevented generations
1 and 2 being collected.