better fix for reconnection loop