Bug fix---make sure to unreference signal handlers

I was not properly unreferncing signal handlers when ignoring or setting
the signal default action, or when changing the handling of a function
to just a plain catch.
Bug fix---clear out signal flags when doing a plain catch.