Fixed various issues

Fixed an issue with clean-up if a Consumer fails to register with the
Environment Provider. Fixed an error in the returned Environment object
on Consumer register. Added exception handling to the demo Consumer to
ensure proper clean-up after an error.