fix trapping signals
Merge pull request #1 from shigi/trap_err

fix trapping signals