added check for empty values in lists