implement wait command.