Fixed join in the wrong place