fix & add code to gallery pages