adding tests for nested objects

Opening this PR again for the new tests.