Fix nested component generation and add a test
Fix component test.