Fix magn1571: indexing into string does not work properly

Fix issue that it is able to index into string and change its value but not able to return indexed string value. That because at runtime we only check the object is array or not. Should add checking for string as well.

Related test case added.