fixed bug to recognize opt.sampling=="strue"