fixing threading issue on startup