Fixed a bug of build_filter.
More complex relationships of tables...