Fix init procedure, handle runOnUiThread differently