better way to judge if list is empty