Backport #589