Either check for faulty readings and neglect them. Or dig into the cause of the faults. One thing that might cause them is that the sensor logic is not as fast as the Arduino. With some other digital sensor - don't remember what it was - people did something like this:
digitalWrite(S2,LOW);
digitalWrite(S2,LOW);
digitalWrite(S3,HIGH);
digitalWrite(S3,HIGH);