Fixed some error conditions when list is not populated/selected.
Minor code cleanup.