Fixing sampling algorithm