Some bug fixes and improvements.

Bug fixes inside new account code and small codes.