add better test
add fix for case with two conditions on outer table