add exiterror almost everywhere