fixed bugs in AccountsManager and its corresponding spec