Port fixes for #1612