Fixed bug with writing the credentials file.