Fixed name generation so it hopefully works on whatever newline format the OS has