bugfix (possible self-join)