bug fix for gallery