Various fixes to reduce memory usage (and improve href resolution).