Created some test cases for the accounts app

Changed some code due to possible errors found when testing