working the seg faults out