bug fixed for gallery template issue

bug fixed for gallery template issue