fix get_context in build_gallery.py