This commit makes sure that there is only one identity manager that is initialized early enough so hooks can be added properly. Closes #446