Corrected sorting in images.js