Applied fix from #2809