Fixed two bugs in testCredentials