improve credential check