working version of reconnect after master failure