Fix leaking of app during init