Fix async registration of shared services.
Added tests
Added tests and fixed bug where getting a non existent error would throw an unexpected error.