Fix NPE and add some line break stuff