Cleanup: Removed redundant gallery.build_index()
Added escape for buggy delete function.