XD-1881: Cope with ending slash in xd.home

Add safeguard against ThreadLocal being set