add some error catching