Fix for issue 4875

It looks like the type for the whole pattern wasn't being written back, so when privacy tried to look it up everything died.