check for empty list instead of length