Bug fix on getDevice