fixes #136 although the code could be cleaner.

Works for both singular and plural embedded objects.