fix forever loop in error printing