Changed the way to detect touch device.