Bacported fix.