error loop functions