* fix the index used to get the sfx substring
* handle cases where the sxf variable is not a built-in
This prevents a crash that happened whenever the sfx
variable's name had less than 5 characters (4 before this
pr), since the substring method was called regardless of
the name's size.