Fix duplicate line and doc newline issue