fix gallery, added missing js code