revamp fix for substr, fix substr<-