Make images in gallery ordered

In 5.0 the images are not ordered, but chaotic.
They were ordered sometimes in 4.5