improve handling of wrong scripts