fixed newline counting