added a function to fix newline issues