Fixing reconnect bug similar to sensor library Issue #2.