Fix a row count bug when list is empty