Fix in handling callbacks

Callbacks are removed from the dictionary before executing the callback function (to solve problems with concurrent calls).
On clearing all callbacks, the callbacks are removed from the dictionary first and then called (to ensure that every callback is at least called once).
Subscription callback is removed from dictionary when unsubscribed successfully (to ensure that no subscribtion error is fired when disconnecting).