modify gallery.js