fixed some segmentation faults, for interface