Fix NPE and prevent loading page on rotate