fixed bug in next command -- given a list of messages, it would