Modified the getAsString function.