fixed bug in sample 31