Fixing discrete sample bug