Fixing the gallery captions to not show when titles are empty. Also set in some escaping too.