order messages correctly