adjusted isTouchDevice function