scan script bugfixes