Improving document root handling