Fix issues with authentication and a broken unit test