Code runs, but throws an exception error at UpdateUI