Fix NPE when user saves app in the background and reopen it