formatting fixes, along with handling an error in the gallery