toObject: simplification and slight perfomance improvement when value is a string.