scan script + error handling