fix a error when headers is undefined.