fixes gallery script