Fixed sampling bug