fix GC bug

I fixed the GC bug.

Merijn, can you please verify? I fixed originally in another version of snet-rts and then I realised that you had changed quite a lot in the snet-rts. I ran the test and it seems fine but I was not 100% sure.