Script parsing fixes