Fix to make registry entry hook work, plus more exception cleanup.