This way it's easier to get right. See previous commit. (cherry picked from commit 3556f6bf4c)
3556f6bf4c