Fix bug to do with receiving multiple messages at once