Added validity check in list command.