Fix stack overflow due to many many recursions when freeing tags. Fix memory waste when encoding post data. Apply magic numbers for post data to determinte content