minor tweaks to safe signal handling