further error handling improvements.