changed error handling around so we don't add bad or empty Memento headers if something goes wrong or we're at the edge of the history