implementing joining, fixes in grouping joins