Fix signal trapping; add debugging.