Fixed the weird error when the list is empty