MP1-4231 : Fix an index out of range bug