Error: [] operator not supported for strings: Cannot assign by reference to overloaded object