It seems the fuel-left calculation is made for all the trains combined, not checking each direction. I've had a few trains run out of fuel, though now I increased the limit to a lot more, it ran by and refueled. So for trains that go mostly one direction, they don't fall below the threshold. For the trains that had to swap direction a lot, it seemed to work better.
Would it be possible to add a check that calculates fuel left in each direction, not both combined?