fixed mistaken backwards logic on error checks