Simple fix for aliasing where clause in withRelated