fixed race condition in PIO when transfer ends prematurely