joins and pattern issue