fixing bug where $firstInSeries would not be assigned correctly when retrieving messages