revamp fix for substr, fix substr<-
Merge branch '21-misc-cleanup' into 23-prim-formals