This breaks for me - isn't `$headers['Location'][0]` just string indexing the Location header?