public synchronized Script popScript() {
		synchronized (scriptStack) {
			if (!scriptStack.isEmpty() && scriptStack.peek() != null) {
				Script script = scriptStack.pop();
				log(Bot.class, Level.FINE, "Stopping script " + script.getManifest().name() + "...");
                try {
                    script.close();
                } catch (final Throwable t) {
                    log(script, t);
                }
                
                script.destroy();
				getCanvas().getListeners().remove(script);
				if (scriptStack.isEmpty()) {
					inputHandler.setHumanInput(true);
				}
				return script;
			}
		}
		return null;
	}