proper GC and heartbeat stopping