fix broken permalinks in galleries