fix a location leak when exceptions occur