Fix content tag selection and replacement issues. Fixes #38 and #39.