fixing error catching bugs