Fix fromIndex/toIndex. Close #56