Fix printing newline if there is nothing to print