It appears to be a hard-coded limit length, but appears to work correctly in the other cases... Whats the algorithm you use?