fix for empty list (not able to add element to empty list)