fixed some issues with the gallery function, still need to fix wrong category pictures