fix key error credential nil