minor changes : check list is empty or undefined