fix for "ignoring return value of ?write'" error