i actually think the error is from the alias /brepbytes which is not my alias, so im not sure how to fix it.

Code:
/brepbytes &temp $+(%,_IMG_GALLERY_,%) $new_img_gallery

alias -l new_img_gallery {
  var %nig = $chr(32)
  noop $findfile(scripts\pws\htdocs\gallery\,*.jpg;*.jpeg;*.jpe;*.png;*.gif;*.bmp,0,var %nig = %nig <a href=" $+ gallery/ $+ $nopath($1-) $+ "><img src="a $+ gallery/ $+ $nopath($1-) $+ " width="50" height="50"></a> $+ $iif(5 // $findfilen,<br>))
  return %nig
}

alias -l brepbytes {
  var %p,%s,%r = 1,%l = 1
  bunset &replace
  while (%l <= $bvar($1,0)) {
    while ($bfind($1,%l,$2).text) {
      %p = $ifmatch
      while (%l < %p) {
        bset &replace %r $bvar($1,%l,1)
        inc %r
        inc %l
      }

      bset -t &replace %r $3-
      inc %l $len($2)
      inc %r $len($3-)
    }
    bset &replace %r $bvar($1,%l,1)
    inc %r
    inc %l
  }
  %l = 1
  while ($bvar(&replace,%l,1) != $null) {
    bset $1 %l $ifmatch
    inc %l
  }
}