Join index fix

- finish a fix on indexing for joins in clang
- added a test to cover this