Added try/catch around registry calls