fixed inner joining in beforeFind