making sure that messages get added to the ui on the main thread