fixed gallery code