fix to maintain images order in gallery