(FIX) Implement a loop to ensure all buffer data are read