bugfix applyscript