fixed problem with subjoins on subselects