Improved scan #1 for error handling