Fix gallery bugs