Bug fixes to accounts system