fixed memory leak when trying to reconnect to broker