Fixed device check code issue

@mmell