specify distinct to avoid counting nulls