It's possible that when the trough eject is stacking balls causing two to be in the trough but not counted. Of course, under testing conditions you won't run into this since you're not letting the game eject from the trough. This seems unlikely if it's truly always only after two ball locks.
When it drains, does it immediately go into EOB bonus THEN ball search or does it not recognize that you've drained and trigger ball search before the EOB?