wrapping results into relations; fixed filtering