Fix NPE on some images. Fix gui.