fix sampling bug