fix undefined $gallery_template issue