Fix some bugs with the creation of nested objects