Restore some master branch fixes lost in the vec4-stack merge.