fix issue with error handling.