fix bugs in sample