fixes messages to display in correct order