     [ last-line# ] keep line-end ;
 
 : validate-loc ( loc document -- newloc )
-    over first over model-value length >= [
+    over first over value>> length >= [
         nip doc-end
     ] [
         over first 0 < [

    >r >r >r "" r> r> r> set-doc-range ;

: last-line# ( document -- line )
    model-value length 1- ;

: validate-line ( line document -- line )
    last-line# min 0 max ;

    ] if ;

: doc-string ( document -- str )
    value>> "\n" join ;

: set-doc-string ( string document -- )
    >r string-lines V{ } like r> [ set-model ] keep
