updated for version 7.0199
diff --git a/src/eval.c b/src/eval.c
index 6ec0975..d29f1a4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -15509,11 +15509,13 @@
 	pos.col = 0;
 	if (name[1] == '0')		/* "w0": first visible line */
 	{
+	    update_topline();
 	    pos.lnum = curwin->w_topline;
 	    return &pos;
 	}
 	else if (name[1] == '$')	/* "w$": last visible line */
 	{
+	    validate_botline();
 	    pos.lnum = curwin->w_botline - 1;
 	    return &pos;
 	}