Fix bug in DM space transformation when sampling