set message_window earlier to avoid crash on startup.