Bugfix multijoin query build