Added backport of respect docdir patch