(cherry picked from commit 59780fd046)
59780fd046
Imported by @reduz from b8ec29b6b6 Custom changes will be remade properly in the next commit.
b8ec29b6b6