fixed input detection logic

previous implementations was wrong. It always evaluates to `true`