added some new error cases like creation of credential file failing and removed an unititalized variable error