Further error handling improvements