Fixing an issue with grabbing head contents when tag is above <head>

One of my crazy 2:30am pull requests.