Floodfill with Borland pascal 7 creates a runtime 216 error

Well it creates a protection fault.  Way back like 6 years ago, when I
first used floodfill it kept crashing the system under pure dos.  Then I
call them and said you have to dec the stack point by two. So here is
the snippet of code.

                  if (c<>black) and (c<>fillcolor) then
                      if (getpixel(dr.Xmin-1,dr.Ymin)<>black) and
                         (getpixel(dr.Xmin,dr.Ymin-1)<>black) and
                         (getpixel(dr.Xmin+1,dr.Ymin)<>black) and
                         (getpixel(dr.Xmin,dr.Ymin+1)<>black) then
                            dec SP
                            dec SP

You notice the two dec SP asm functions without this I would get a
protection fault.
I already traced it and it does crash right when it tries to dec the
SP.  Now I would
like to use this program in 256 colors because everything is so much
faster, but I get
protection fault again from floodfill, if I simply remed out floodfill I
never crash.  So
there is a bug in this function tested under windows 98SE.  I can't
trust NT/2000 because
they mucked up 16 bit protected mode so bad the application crashes in
several places.

What I need is if someone managed to fix the floodfill code and has a
patch or wrote their
own that will work with MetaWINDOW/386 Version 5.0.  ScreenRect is equal
to the
screen 640x480.  This program uses standard VGA nothing fancy.