script bugfixes