Fix gallery performance