wscript: Add/fix some function and type checks.