fixed redirect loop on galleries