fixed sampling script