modify n to dict and add some newline
change print to error