Fix for gallery mode