Fix memory corruption bug in method "getContentsOfString"