bug fixed: case of self-join is not considered before