Fix getFolderModel adding empty lines in some cases