fixing error handling in driver