fixed reference counting bug in rpc and signal handlers