fixed threading problems with credential storage