improved touchpad "if" check