Imported by @reduz from b8ec29b6b6 Custom changes will be remade properly in the next commit.
b8ec29b6b6