fixed GC memory bug, fixed tests