simplify and fix mobile detection condition