slight better error catching