add some error checks