[Fix] bug which causes expired credentials to be used