Re applied removed code
Fix NRE
Correctly get custom headers from the response