fix wrong variable names bug in gallery