Fix catching AttributeError