#17 fix bug in sample method