Fix handling of error.