Workaround for #4135

Should shortly be applied upstream, but we need it now.