fix handling realm with spaces