Based on !21019 (merged).
The ANV changes are only compile tested but if they work, they should fix #8199 (closed) on ANV.