Fix error where strToObj is undefined when it is used