Fix join conditions

- [x] expose with test
- [x] fix wrong positions bug
- [ ] fix lost condition ordering bug