Move join check where it belongs