prevent query error if list is empty