invokecmd() error checking and stringbuffer ->  stringbuilder