prototypes for cleanup and sig_err