added some sig handling code