Port fixes for #1599