Minor code changes to allow of logging of exception