added device verification to issue 166, added tests for issue 169