some error catching for db connection