after optimization, left input buffer length is not right, fixed