Fixed the bug that split file name uncorrectly.

index out of bound because the wrong calculation way. Fixed it.