Backport of fix for AS7-4667