Fix bug accessing credentials before they have been added as an attribute