updated scanner error handling.