fixed bug when list is empty