gallery missing json functions fix