resolves #337 set doctitle attribute

- also fix doctitle and header title logic
- better test cases for doctitle and header title