I've scrap the logic at the top and adjusted the joins. Cross Apply changed to Outer Apply - for the arrays. That fixed it. Nothing works than some sleep!