local error check + statistics