Handle no device attached

* Fix issue #9