Added detection of invalid domain pointer