Update gallery.js

fixed minor bug