Fix error when messages were received with incorrect order