Backported fixes for