Fix FIFO wrap check

Improve FIFO _get and _put to use more robust checks.