fixes and specs for runInNewDomain