Updated library for deal with offset and length