Fix bug: java.lang.IllegalArgumentException: pointerIndex out of range