Add tests and fixes for subscribing