Use int type for sample index
Merge pull request #10 from nlefler/index_fix

Index fix