Small bug fixes in image gallery