Fix gallery init error when no gallery on page