better gallery tag detection