Bug fix for gallery shortcode