small error checks, tests