Fix error in runOnUiThread function.