improving credential management
fixing bug with incorrect var reference