Exception: [] operator not supported for strings