Resolving the problem of updating GUI with updateOnUi() method