fix READ_LENGTH bug