Fixed bugs with testing helper functions which could get into a bad state if code ran before users were created