[bugfix] sorting of gallery files did not work as expected when displaying the gallery items backwards