fixed R build, misc compile issues