a bit of error catching