replace endOffset by lastFrame