fix segmentation faults in bdw-gc mode