core: only set ID on machine if data dir [GH-3827]