fixed seg faults.