Fix trailing newline not getting printed