Fixed some issues with determining which io flag is first.