added encodingOfHeaders call to base64