Use wfScript() instead of globals in a few places

Change-Id: I8a23e7b647c082119799b5bc8cfd5ff76c712f85