Fixing issue with empty list