Update from master

Fixes various issues including those related to multi-domain deployments.