Fix :--- range handling
Add error printing
Do not add unneeded newline