Fixed compile errors in R17