Fix Getrecognizedword loop condition and string modification