Set location headers on document creation, bugfix