Replaced bare except with except Exception