add more bad frame detections in read_nonblock