bebob: fix bugs in previous commit

The position to read buffer is wrong.
The condition for direction is wrong.