Fixes #3 although messages are lost after reconnect