Fix multiple foreach of sub-document data