Upstream fixes not merged in 5.4.y