txb0108 level shifter leads to erroneous ultrasonic sensor reading

While implementing the code at https://github.com/derekmolloy/exploringBB/tree/master/chp13/ultrasonic , txb0108 level shifter reading gives the echo counter reading at r3 register as 1 or 2 no matter how wide is echo pulse is. But while using 7407 open collector buffer as level shifter, it gives me approximately perfect readings. While debugging, it came out that echo rising 0V to 3.3V from txb0108 is not perfect. It goes to approximately 2V and then to 3.3V, the counter(r3 register) starts counting as soon as it crosses 1.8V and due to noise at 2V level it barely counts 1 or 2 times and comes out of loop giving almost zero distance reading. Is this issue only with the particular one I bought? Please give your experience with txb0108. I bought it for using with motor driver to send PWM and control signals but now I am wary about doing that after I’ve faced issues with ultrasonic readings.

Can someone clarify about switching speeds of txb0108 and 7407? As per manufacturer’s datasheet(page 16), http://www.ti.com/lit/ds/symlink/txb0108.pdf , txb0108 should work 2.5MHz without deviation.