added fifo handling