improved debug message for filewrite