fix unit test to use flatten