[DF-5322] Fix index out of bounds exception