added extra condition to getRepByID