Fixed removal of signal subscriptions and added some assertions to
verify correctness.