Fix sampling error issue