Merge pull request #1367 from billhollings/device-loss-fixes

Device loss fixes