--- ico.tcl.orig	2005-08-14 14:59:51.000000000 +0400
+++ ico.tcl	2006-01-06 10:24:30.000000000 +0300
@@ -872,12 +872,15 @@
 	set fh [open $file w+]
 	fconfigure $fh -eofchar {} -encoding binary -translation lf
 	bputs $fh sss 0 1 0
-	seek $fh 0 start
+	seek $fh 4 start
+	set is_new 1
     } else {
 	set fh [open $file r+]
 	fconfigure $fh -eofchar {} -encoding binary -translation lf
+	set is_new 0
     }
-    if {[file size $file] > 4 && "[getword $fh] [getword $fh]" ne "0 1"} {
+    if {!$is_new && [file size $file] > 4 && 
+	"[getword $fh] [getword $fh]" ne "0 1"} {
 	close $fh
 	return -code error "not an icon file"
     }
