fixed bugs in response header handling