Fix title handling in HTML builder.
merge 4.0 branch to master. fix conflicts.