Fixed sampling bug.