Improved PrintWriter handling.