@SuppressWarnings("unchecked")
	BitSet lookupValue(String variable, boolean plurals) throws ScriptException {
		if (logMessages)
			viewer.scriptStatus("lookupValue(" + variable + ")");
		Object value = variables.get(variable);
		if (value != null) {
			if (value instanceof Token[]) {
				value = expression((Token[]) value, 2);
				variables.put(variable, value);
			}
			return (BitSet) value;
		}
		if (plurals)
			return null;
		int len = variable.length();
		if (len < 5) // iron is the shortest
			return null;
		if (variable.charAt(len - 1) != 's')
			return null;
		if (variable.endsWith("ies"))
			variable = variable.substring(0, len - 3) + 'y';
		else variable = variable.substring(0, len - 1);
		return lookupValue(variable, true);
	}