Some scripting fixes